package top.alanshelby.mybatis.util;

import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import top.alanshelby.mybatis.bean.Dept;

public class MyObjectFactory extends DefaultObjectFactory {

    @Override
    public Object create(Class type) {
        if (Dept.class == type) {
            // 依靠父类提供的create方法实例化Dept对象
            Dept dept = (Dept) super.create(type);
            dept.setCity("Shanghai");
            return dept;
        }
        return super.create(type);
    }
}
